package com.example.demo.design.demo18_memento;

/**
 * Created by 蔡超 on 2018/10/4.
 */
public class Client {
    public static void main(String[] args) {
        GamRole gamRole = new GamRole(100,200,300);
        System.out.println(gamRole);

        RoleStateMemento roleStateMemento = gamRole.saveState();
        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setRoleStateMemento(roleStateMemento);

        gamRole.fight();
        System.out.println(gamRole);

        RoleStateMemento roleStateMemento2 = roleStateCaretaker.getRoleStateMemento();
        gamRole.recoveryState(roleStateMemento2);
        System.out.println(gamRole);

    }
}
